const std = @import("std");
const sys = @import("lib/syscall.zig");
const fprint = @import("lib/user.zig").fprint;

export fn main(argc: usize, argv: [*]const sys.c_str) noreturn {
    if (argc < 3) {
        fprint(2, "Usage: ln [-s] old new\n", .{});
        sys.exit(1);
    }

    const ret = if (argv[1][0] == '-')
        sys.symlink(argv[2], argv[3])
    else
        sys.link(argv[1], argv[2]);

    sys.exit(ret);
}
